
from functools import wraps

from flask import render_template, redirect, url_for

from utils.myitchat import mychat

def is_login(func):
    @wraps(func)
    def inner():

        if mychat.bot:
            if mychat.bot.alive:
                print('----')
                return func()
            else:
                print('++++')
                return redirect(url_for('front.login'))
        else:
            return redirect(url_for('front.login'))

    return inner